#ifndef __LS_UTIL_H__
#define __LS_UTIL_H__
/*
    1.系统时间
    2.文件目录是否存在
    3.文件路径
    4.创建目录
*/
#include <iostream>
#include <filesystem>
#include <ctime>

namespace log_system
{
    namespace util
    {
        namespace fs = std::filesystem;

        struct Date
        {
            static time_t now()
            {
                return time(nullptr);
            }
        };

        struct File
        {
            static bool exist(const std::string& fileName)
            {            
                return fs::exists(fileName);
            }

            static std::string parentPath(const std::string& fileName)
            {

                return fs::path(fileName).parent_path().string();
            }

            static void createDirectory(const std::string& pathName)
            {
                if (exist(pathName))
                    return;
                fs::create_directories(pathName);
            }

        };
        
        
    }
}
#endif